package com.nts.visionworks.core.security.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.validation.constraints.Max;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * SecurityAccessTrace generated by hbm2java
 */
@Entity
@Table(name = "security_access_trace", catalog = "visionworks")
public class SecurityAccessTrace implements java.io.Serializable
{

	private SecurityAccessTraceId id;
	private SecurityIdentity securityIdentity;
	private short accessType;
	private String remoteIpAddress;
	private String localIpAddress;

	public SecurityAccessTrace()
	{
	}

	public SecurityAccessTrace(SecurityAccessTraceId id,
			SecurityIdentity securityIdentity, short accessType,
			String localIpAddress)
	{
		this.id = id;
		this.securityIdentity = securityIdentity;
		this.accessType = accessType;
		this.localIpAddress = localIpAddress;
	}

	public SecurityAccessTrace(SecurityAccessTraceId id,
			SecurityIdentity securityIdentity, short accessType,
			String remoteIpAddress, String localIpAddress)
	{
		this.id = id;
		this.securityIdentity = securityIdentity;
		this.accessType = accessType;
		this.remoteIpAddress = remoteIpAddress;
		this.localIpAddress = localIpAddress;
	}

	@EmbeddedId
	@AttributeOverrides(
	{
			@AttributeOverride(name = "accessDateTime", column = @Column(name = "AccessDateTime", nullable = false, length = 19)),
			@AttributeOverride(name = "identityId", column = @Column(name = "IdentityId", nullable = false)) })
	public SecurityAccessTraceId getId()
	{
		return this.id;
	}

	public void setId(SecurityAccessTraceId id)
	{
		this.id = id;
	}

	@EntityIdNotNull(message = "validation.securityAccessTrace.securityIdentity.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "IdentityId", nullable = false, insertable = false, updatable = false)
	public SecurityIdentity getSecurityIdentity()
	{
		return this.securityIdentity;
	}

	public void setSecurityIdentity(SecurityIdentity securityIdentity)
	{
		this.securityIdentity = securityIdentity;
	}

	@Column(name = "AccessType", nullable = false)
	public short getAccessType()
	{
		return this.accessType;
	}

	public void setAccessType(short accessType)
	{
		this.accessType = accessType;
	}

	@Column(name = "RemoteIpAddress", length = 39)
	public String getRemoteIpAddress()
	{
		return this.remoteIpAddress;
	}

	public void setRemoteIpAddress(String remoteIpAddress)
	{
		this.remoteIpAddress = remoteIpAddress;
	}

	@Column(name = "LocalIpAddress", nullable = false, length = 39)
	public String getLocalIpAddress()
	{
		return this.localIpAddress;
	}

	public void setLocalIpAddress(String localIpAddress)
	{
		this.localIpAddress = localIpAddress;
	}

}
